
package com.feib.soeasy.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * @title (#)PaymentConfig.java<br>
 * @description <br>
 * @author Jimmy Liu<br>
 * @version 1.0.0 2010/11/25
 * @copyright Far Eastern International Bank Copyright (c) 2010<br>
 * @2011/3/5 create by Jimmy Liu<br>
 */
@Entity
@Table(name = "PAYMENT_CONFIG")
public class PaymentConfig extends AuditEntity {
    
    /**
     * 
     */
    private static final long serialVersionUID = 2236004583027540695L;

    /**
     * PK in Table
     */
    private Long paymentConfigPk;
    
    /**
     * 所屬群組</br>
     */
    private Group group;
    
    /**
     * 收費代碼
     */
    private String configNo;
    
    /**
     * 收費名稱
     */
    private String configName;
    
    
    /**
     * 收費週期</br>
     * 1:每月</br>
     * 2:每2個月</br>
     * 3:每季</br>
     * 4:每半年</br>
     * 5:每年</br>
     */
    private Integer cycleType;
    
    /**
     * 優惠金額
     */
    private Long offerAmount;
    
    /**
     * 下次執行日期</br>　
     */
    private Date nextExcuteTime;
    
    /**
     * 繳款截止日期天數
     */
    private Integer limitDays;
    
    /**
     * 繳款截止日 = 下次執行日期 + 繳款截止日期天數
     */
    private Date payDue;
    
    /**
     * 備註
     */
    private String configNote;
    
    private List<PaymentConfigItem> paymentConfigItems;

    
    /**
     * @return the paymentConfigPk
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="PAYMENT_CONFIG_PK", nullable=false)
    public Long getPaymentConfigPk() {
        return paymentConfigPk;
    }

    
    /**
     * @param paymentConfigPk the paymentConfigPk to set
     */
    public void setPaymentConfigPk(Long paymentConfigPk) {
        this.paymentConfigPk = paymentConfigPk;
    }

    
    /**
     * @return the group
     */
    @ManyToOne
    @JoinColumn(name="GROUP_PK", nullable=false)
    public Group getGroup() {
        return group;
    }

    
    /**
     * @param group the group to set
     */
    public void setGroup(Group group) {
        this.group = group;
    }

    
    /**
     * @return the configNo
     */
    @Column(name="CONFIG_NO", nullable=false, length=20)
    public String getConfigNo() {
        return configNo;
    }

    
    /**
     * @param configNo the configNo to set
     */
    public void setConfigNo(String configNo) {
        this.configNo = configNo;
    }

    
    /**
     * @return the configName
     */
    @Column(name="CONFIG_NAME", nullable=false, length=50)
    public String getConfigName() {
        return configName;
    }

    
    /**
     * @param configName the configName to set
     */
    public void setConfigName(String configName) {
        this.configName = configName;
    }

    
    

    
    /**
     * @return the cycleType
     */
    @Column(name="CYCLE_TYPE", nullable=false)
    public Integer getCycleType() {
        return cycleType;
    }

    
    /**
     * @param cycleType the cycleType to set
     */
    public void setCycleType(Integer cycleType) {
        this.cycleType = cycleType;
    }

    
    /**
     * @return the offerAmount
     */
    @Column(name="OFFER_AMOUNT")
    public Long getOfferAmount() {
        return offerAmount;
    }

    
    /**
     * @param offerAmount the offerAmount to set
     */
    public void setOfferAmount(Long offerAmount) {
        this.offerAmount = offerAmount;
    }

    
    /**
     * @return the nextExcuteTime
     */
    @Column(name="NEXT_EXCUTE_TIME")
    public Date getNextExcuteTime() {
        return nextExcuteTime;
    }

    
    /**
     * @param nextExcuteTime the nextExcuteTime to set
     */
    public void setNextExcuteTime(Date nextExcuteTime) {
        this.nextExcuteTime = nextExcuteTime;
    }


    
    /**
     * @return the configNote
     */
    @Column(name="CONFIG_NOTE")
    public String getConfigNote() {
        return configNote;
    }


    
    /**
     * @param configNote the configNote to set
     */
    public void setConfigNote(String configNote) {
        this.configNote = configNote;
    }


    
    /**
     * @return the limitDays
     */
    @Column(name="LIMIT_DAYS", nullable=false)
    public Integer getLimitDays() {
        return limitDays;
    }


    
    /**
     * @param limitDays the limitDays to set
     */
    public void setLimitDays(Integer limitDays) {
        this.limitDays = limitDays;
    }


    
    /**
     * @return the payDue
     */
    @Column(name="PAY_DUE")
    public Date getPayDue() {
        return payDue;
    }


    
    /**
     * @param payDue the payDue to set
     */
    public void setPayDue(Date payDue) {
        this.payDue = payDue;
    }


    
    /**
     * @return the paymentConfigItems
     */
    @OneToMany(cascade = CascadeType.ALL, orphanRemoval=true, mappedBy="paymentConfig")
    public List<PaymentConfigItem> getPaymentConfigItems() {
        return paymentConfigItems;
    }


    
    /**
     * @param paymentConfigItems the paymentConfigItems to set
     */
    public void setPaymentConfigItems(List<PaymentConfigItem> paymentConfigItems) {
        this.paymentConfigItems = paymentConfigItems;
    }

    

}
